<?php

namespace app\api\controller\creative;

use app\api\model\Picture;
use app\api\service\creative\EventService;
use app\lib\qiniu\PictureUploader;
use app\lib\qiniu\VideoUploader;
use think\Request;

class Event
{
    protected $Service;

    public function __construct()
    {
        $this->Service = EventService::getInstance();
    }

    public function getRecords(Request $request)
    {
        $params = $request->get();
        $result = $this->Service->getRecords($params);
        return writeJson(200,$result,'获取视频');
    }

    public function getCreative(Request $request)
    {
        $params = $request->get();
        $result = $this->Service->getCreative();
        return writeJson(200,$result,'获取视频');
    }

    public function getTextList(Request $request)
    {
        $params = $request->get();
        $result = $this->Service->getTextList($params);
        return writeJson(200,$result,'获取文案');
    }

    public function modifyText(Request $request)
    {
        $params = $request->post();
        $result = $this->Service->modifyText($params);
        return writeJson(200,$result,'修改文案');
    }

    public function addGroup(Request $request)
    {
        $params = $request->post();
        $result = $this->Service->addGroup($params);
        return writeJson(200,$result,'新增分组');
    }

    public function getGroup()
    {
        $result = $this->Service->getGroup();
        return writeJson(200,$result,'获取视频分组');
    }

    public function getVideos(Request $request)
    {
        $params = $request->post();
        $result = $this->Service->getVideos($params);
        return writeJson(200,$result,'获取视频列表');
    }

    public function getList(Request $request){
        $params  = $request->get();
        $result = $this->Service->getList($params);
        return writeJson(200,$result,'领取视频');
    }

    public function uploadVideo(Request $request){
        $params = $request->post();
        $this->Service->uploadVideo($params);
        return writeJson(201,"",'上传成功');
    }

    public function createEvent(Request $request)
    {
        $params  = $request->post();
        $result = $this->Service->createEvent($params);
        return writeJson(200,$result,"创建任务成功");
    }

    public function setCreative(Request $request)
    {
        $params  = $request->post();
        $result = $this->Service->setCreative($params);
        return writeJson(200,$result,"导入成功");
    }

    public function setText(Request $request)
    {
        $params  = $request->post();
        $result = $this->Service->setText($params);
        return writeJson(200,$result,"导入成功");
    }

    public function updateStatus(Request $request)
    {
        $params  = $request->post();
        $result = $this->Service->updateStatus($params);
        return writeJson(200,$result,"更新成功");
    }

    public function saveFile(Request $request)
    {
        $params  = $request->post();
        $result = $this->Service->saveFile($params);
        return writeJson(200,$result,"保存成功");
    }

    public function getEvents(Request $request)
    {
        $params = $request->get();
        $result = $this->Service->getEvents($params);
        return writeJson(200,$result,'获取任务');
    }

}
